package com.edu.bean;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

public class User {

    @JsonIgnore //java对象 再转成JSON字符串的时候，会自动的忽略掉这个属性
    private int userId;

    private String username;

    private String password;

    private int userAge;

    @JsonFormat(pattern = "yyyy-MM-dd") //规定 json字符串 与日期类型进行转换时，转换的格式
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date birthday;

    private String email;

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public int getUserAge() {
        return userAge;
    }

    public void setUserAge(int userAge) {
        this.userAge = userAge;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public User() {
    }

    public User(int userId, String username, String password, int userAge, Date birthday, String email) {
        this.userId = userId;
        this.username = username;
        this.password = password;
        this.userAge = userAge;
        this.birthday = birthday;
        this.email = email;
    }

    @Override
    public String toString() {
        return "User{" +
                "userId=" + userId +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", userAge=" + userAge +
                ", birthday=" + birthday +
                ", email='" + email + '\'' +
                '}';
    }
}
